package com.manbu.springcloud.controller;

import com.manbu.springcloud.pojo.Dept;
import com.manbu.springcloud.service.FeignDeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @description: 消费者不应该有service层 采用resultFUll 风格url 请求
 * @author: wanghan
 * @time: 2021/4/19 下午11:48
 */
@RestController
public class DeptConsumerDept{
    @Autowired
    private FeignDeptClientService service;

   @RequestMapping("/consumer/dept/get/{id}")
   public Dept queryDeptById(@PathVariable("id") Long id){
       return this.service.queryDeptById(id);
   }

    @RequestMapping("/consumer/dept/add")
    public boolean addDep( Dept dept){
        return this.service.addDept(dept);
    }
    @RequestMapping("/consumer/dept/list")
    public List<Dept> deptList(Dept dept){
        return this.service.queryAll();
   }

}
